#ifndef GAMEFIELD_H
#define GAMEFIELD_H

#include <QtCore>
#include <QtGui>

#include "general.h"
#include "animation.h"
#include "unititem.h"
#include "toweritem.h"

class GameField : public QGraphicsItem
{
public:
    GameField(const QPixmap & pixmap, QGraphicsItem * parent = 0);
    QRectF boundingRect() const;


    void startUnit(UnitItem * unit);
    void setWaypoints(const Waypoints & ways);
    void putTower(TowerItem * tower);
    void cancelPutTower();
private:
    QPixmap m_pixmap;
    TowerItem * m_putTower;
    QList<UnitItem*> m_units;
    Waypoints m_waypoints;
    QList<qreal> m_lengthWaypoint;
    qreal m_lengthWaypoints;
    QPointF m_size;

    void calcWaypointsLength();
protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
};

#endif // GAMEFIELD_H
